package com.ruoyi.teach.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.constant.BusinessTypeEnum;
import com.ruoyi.teach.domain.SchoolDailyMeet;
import com.ruoyi.teach.service.ISchoolDailyMeetService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 工作交接记录Controller
 *
 * @author ruoyi
 * @date 2025-07-16
 */
@RestController
@RequestMapping("/teach/meet")
public class SchoolDailyMeetController extends BaseController
{
    @Autowired
    private ISchoolDailyMeetService schoolDailyMeetService;

    /**
     * 查询工作交接记录列表
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:list')")
    @GetMapping("/list")
    public TableDataInfo list(SchoolDailyMeet schoolDailyMeet)
    {
        startPage();
        List<SchoolDailyMeet> list = schoolDailyMeetService.selectSchoolDailyMeetList(schoolDailyMeet);
        return getDataTable(list);
    }

    /**
     * 导出工作交接记录列表
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:export')")
    @Log(title = "工作交接记录", businessType = BusinessTypeEnum.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SchoolDailyMeet schoolDailyMeet)
    {
        List<SchoolDailyMeet> list = schoolDailyMeetService.selectSchoolDailyMeetList(schoolDailyMeet);
        ExcelUtil<SchoolDailyMeet> util = new ExcelUtil<SchoolDailyMeet>(SchoolDailyMeet.class);
        util.exportExcel(response, list, "工作交接记录数据");
    }

    /**
     * 获取工作交接记录详细信息
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(schoolDailyMeetService.selectSchoolDailyMeetById(id));
    }

    /**
     * 新增工作交接记录
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:add')")
    @Log(title = "工作交接记录", businessType = BusinessTypeEnum.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SchoolDailyMeet schoolDailyMeet)
    {
        return toAjax(schoolDailyMeetService.insertSchoolDailyMeet(schoolDailyMeet));
    }

    /**
     * 修改工作交接记录
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:edit')")
    @Log(title = "工作交接记录", businessType = BusinessTypeEnum.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SchoolDailyMeet schoolDailyMeet)
    {
        return toAjax(schoolDailyMeetService.updateSchoolDailyMeet(schoolDailyMeet));
    }

    /**
     * 删除工作交接记录
     */
//    @PreAuthorize("@ss.hasPermi('teach:meet:remove')")
    @Log(title = "工作交接记录", businessType = BusinessTypeEnum.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(schoolDailyMeetService.deleteSchoolDailyMeetByIds(ids));
    }
}
